﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Emailing;
using Volo.Abp.Emailing.Smtp;
using Volo.Abp.TextTemplating;

namespace PHMEE.BackgroundJobs
{
    public class TestJob : IBackgroundJob
    {
        private readonly IVesselManager vesselManager;
        private readonly IEmailSender emailSender;

        public TestJob(IVesselManager vesselManager, IEmailSender emailSender)
        {
            this.vesselManager = vesselManager;
            this.emailSender = emailSender;
        }
        public Task ExcuteAsync()
        {
            return Task.Run(() =>
            {
                //StringBuilder sb = new StringBuilder("卢立法测试,VesselType的类型主要有如下几种：");
                //foreach (var item in vesselManager.GetVesselTypes())
                //{
                //    sb.Append($"key：{item.Key},value：{item.Value}");
                //}
                //var email = new MailMessage(new MailAddress("lu.lifa@163.com", "PHMEE Application"), new MailAddress("814570123@qq.com"));
                //email.Subject = "邮件附件测试";
                //email.Body = sb.ToString();
                //email.Attachments.Add(new Attachment("web.config"));
                //emailSender.SendAsync(email);
            });

        }
    }
}
